<?php



if ($_SERVER["REQUEST_METHOD"] == "GET") {
    print_r(json_encode(array("msg" => ",敏感数据,不使用get", "status" => 4)));
    return;
}

session_start();
if (!isset($_SESSION["userinfo"])) {
    print_r(json_encode(array("msg" => "没登录", "status" => 3)));
    return;
}

$cid = $_REQUEST["cid"];
$p_number = $_REQUEST["num"];


include "./DBheuper.php";

//如果已经购买了 修改数量
$update = "UPDATE `cartslist` SET p_number='".$p_number."',p_total=p_number*p_price WHERE c_id='".$cid."'";

$uReulst = sqlQuery($update); //更新的结果
if ($uReulst == 1) {
    print_r(json_encode(array("msg" => "加入成功u", "status" => 1)));
} else {
    print_r(json_encode(array("msg" => "加入成功u", "status" => 2)));
}
